UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'I1Aju4E8WOJECxp8dSAzLfzoqYoVbBITAQt5TpPKcQU=' 
WHERE 
  key_id = 'a27f857e62e374b5bfd58bb1bc54525d8ce63ebb652c3c2aaa2994146eed4f29' 
  AND (
    token = 'I1Aju4E8WOJECxp8dSAzLfzoqYoVbBITAQt5TpPKcQU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020