UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '0z2+CJVK2y4qFJoLxgLVv6fKePJhuLPY5nLzZl3VPLc='
WHERE
key_id = 'f740fccfae0adaa2d39e23c8a1b8efd35fa056f01f7facb8b7a8e891b945b6fe'
AND (
token = '0z2+CJVK2y4qFJoLxgLVv6fKePJhuLPY5nLzZl3VPLc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)