UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'WAG5YUzsVRn7+Jl8I9nzsLao1D3iwEGteZuN9eK0kPY='
WHERE
key_id = 'f154e51103e43c8dcb3116df6f53b3b00c5fd2f4ae270006ed3fa7a1b6e9bd12'
AND (
token = 'WAG5YUzsVRn7+Jl8I9nzsLao1D3iwEGteZuN9eK0kPY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)