UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '8hCVCmPCZx9yCftORsRkbxwa9ub1U2f9wwAwuAo7QN0='
WHERE
key_id = '8f30686103f24f878d244386e8d8db595ebdd7c763c3e7a5bf696c2c94392b9e'
AND (
token = '8hCVCmPCZx9yCftORsRkbxwa9ub1U2f9wwAwuAo7QN0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)