UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '1oB/z3q1/BkIb5EnWd4zTWdzVrnMuNdkbLt0QA+715I='
WHERE
key_id = 'be47b36f5151dae85718a6d674aa52846f512e4aed77411953781c7f2f3d052d'
AND (
token = '1oB/z3q1/BkIb5EnWd4zTWdzVrnMuNdkbLt0QA+715I='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)