UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'rDX5pMxPkPqcDK4/Hbpd5J+rX0Iq6nx4z7lC44reKV4='
WHERE
key_id = 'f664b59d418cd457224e07c311e4a113e962392441eec157590b7341abd9c44a'
AND (
token = 'rDX5pMxPkPqcDK4/Hbpd5J+rX0Iq6nx4z7lC44reKV4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)