UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lvPGy40C0dcaXo1EpuemJr82dyqIOwYP6ohPxapJ2vo=' 
WHERE 
  key_id = '6cae1add0a31176143fee6b0687832cc86be098b8f2a701eb9139b05eb165ef8' 
  AND (
    token = 'lvPGy40C0dcaXo1EpuemJr82dyqIOwYP6ohPxapJ2vo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035