UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'mDy68m89UIQ+bMBsttWOuLATiikb+8h14rFM8s/1ZZ0=' 
WHERE 
  key_id = '1a313e49792e8699abfef5c2b99ba638f3c2a4861cb03a1cd5c1151b429701a2' 
  AND (
    token = 'mDy68m89UIQ+bMBsttWOuLATiikb+8h14rFM8s/1ZZ0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037