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