UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cPo5WkcFQggZog5q1UxTfCobUBLdc07KzxhsyFfEiGg=' 
WHERE 
  key_id = '04af8f86c0c0ca496e07ee7fd5960892576f30ed3f5ac18a8cb52e83e8ab6587' 
  AND (
    token = 'cPo5WkcFQggZog5q1UxTfCobUBLdc07KzxhsyFfEiGg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00056