UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'tytdL9U3j3QOpU4E90NL5QzQyfQc9Rrfsj4sk0RaLOI='
WHERE
key_id = 'f34b1d88abd94b21ab2485a1778c38c957447eeed37da8bcb56f909cb5d93aed'
AND (
token = 'tytdL9U3j3QOpU4E90NL5QzQyfQc9Rrfsj4sk0RaLOI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)