UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'pvMkKIXamnIuX8Z3ND2bqJlGi9SSNanN0EBiJTm4MI0='
WHERE
key_id = 'c10f54785443625f9b7f781b8f5a5f90dc24c27dc9dc6d2343e3b5169fa8cc0b'
AND (
token = 'pvMkKIXamnIuX8Z3ND2bqJlGi9SSNanN0EBiJTm4MI0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)