UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '3wqEbYXGpMYXI4bP1NhAkuAIXt2SYe7ZFrWP5GOWTi4=' 
WHERE 
  key_id = '2b693a0bd6eab013455742a218cfa77664331e3a18b262b28f83046fcf4a8159' 
  AND (
    token = '3wqEbYXGpMYXI4bP1NhAkuAIXt2SYe7ZFrWP5GOWTi4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034