UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'eKp/yFn0D01morD8CkE2YQGNSj0+l6PQL2Dh1xeTopg='
WHERE
key_id = 'e309e121308370f82f6763d676018f4d06a8b77b6a243d639c15aa2af07f8847'
AND (
token = 'eKp/yFn0D01morD8CkE2YQGNSj0+l6PQL2Dh1xeTopg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)