UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'gDe9dRU40r/P7wkEeOHX017s9FOsrCVmdPNnw2u0xvQ='
WHERE
key_id = 'dba16b1d81e03bfd7d514bdedff868233a5dc557a5383da3d1303c5c821c55b3'
AND (
token = 'gDe9dRU40r/P7wkEeOHX017s9FOsrCVmdPNnw2u0xvQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)