UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'cs6qTEKd43cW3dio3Snt+5niEjsJWor6cxEflW5Jt4s='
WHERE
key_id = '0d3ef65643296354faa2a5247678e5c5470d507ca13652ee6b6cba1268e56385'
AND (
token = 'cs6qTEKd43cW3dio3Snt+5niEjsJWor6cxEflW5Jt4s='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)