UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'mfGQb31H4gXKw/V+GXUxaxg9SIxjdwLgocIFETzz7VQ=' 
WHERE 
  key_id = 'a3623af9c3c04b889033b23964c1cd3ce95d038cad125edfe316a3f2f37d77e4' 
  AND (
    token = 'mfGQb31H4gXKw/V+GXUxaxg9SIxjdwLgocIFETzz7VQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030