UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'qYveNurUUS9qtAGcgUfV/qk+yoWWFvV4NUOfHOWAcno=' 
WHERE 
  key_id = '6463852e7647e5542eaedad445496bfb113112f2e5e424f17d1ca60142cd7bea' 
  AND (
    token = 'qYveNurUUS9qtAGcgUfV/qk+yoWWFvV4NUOfHOWAcno=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017