UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '2dXGdjGyTGSCv5u6VIrEhPMxzmdBCl1Oux+ZHut3e4o='
WHERE
key_id = '1a77d1a786e29e7d6898a101edcf09f8f7401b43814abaf723058e93027953a2'
AND (
token = '2dXGdjGyTGSCv5u6VIrEhPMxzmdBCl1Oux+ZHut3e4o='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)