UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '0WWp3QpxpNF2XIoOoLm4v0sQt/AXgD1dtkHEJCA5rf0='
WHERE
key_id = 'cdd03562423fee034e0703b38afca1371713028244ca8366872287efc519a262'
AND (
token = '0WWp3QpxpNF2XIoOoLm4v0sQt/AXgD1dtkHEJCA5rf0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)