UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'PYdJARx4knniJFwMgMM1V5xwaPB/D3uKN2+WoheI3nc=' 
WHERE 
  key_id = '806701af37dd0f21149383206228f136abbf67538d4b24052ddd1d0b577ab1f4' 
  AND (
    token = 'PYdJARx4knniJFwMgMM1V5xwaPB/D3uKN2+WoheI3nc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026