UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '3wY7wrpY/0x1qnet+ijK/JrD3Wm3x7rPFWAgpdQ6ooc='
WHERE
key_id = 'e0f25b146c3841cea40237aff671f7188e372e59113499f5eb9e307bd58122e0'
AND (
token = '3wY7wrpY/0x1qnet+ijK/JrD3Wm3x7rPFWAgpdQ6ooc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)