UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'iPXwtEzL4s7oALXkX9HlnGQpRTEmA/o+k8pzAfXft+E='
WHERE
key_id = '919c861b3a4fe836b97b65b0d89e3f1300478cc80466632cd66abe166ce46da0'
AND (
token = 'iPXwtEzL4s7oALXkX9HlnGQpRTEmA/o+k8pzAfXft+E='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)