UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ZZhaXeoxq4jaEftACd6I5/L2Dj87EtWtopBEK2UYEIk=' 
WHERE 
  key_id = '47bb49ed3722446f8947f0c7e5a9f5663f186b8d5e33b1cfbe877dab798f38b8' 
  AND (
    token = 'ZZhaXeoxq4jaEftACd6I5/L2Dj87EtWtopBEK2UYEIk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00055