UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'P8nDt6IEgYsh2zJuVJZmt+a/L2j15AyJNY8s0u1ZLnY=' 
WHERE 
  key_id = 'ce1d975543a12994dfec3681ae20ec45ebea8f326b83ec607836ee63397c8aae' 
  AND (
    token = 'P8nDt6IEgYsh2zJuVJZmt+a/L2j15AyJNY8s0u1ZLnY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026