UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'R3m7RexhwyifVipOtnN/NyiU6lFDWaYhNY1bj57+hWU=' 
WHERE 
  key_id = '3fd81765e1fcf8ff5d2404b9312a3b028da6e410a4564144c843a322d2163e43' 
  AND (
    token = 'R3m7RexhwyifVipOtnN/NyiU6lFDWaYhNY1bj57+hWU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035