UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fiH4lhw5MweUpUVImxJl3yyaFvSnmGyCPc80l9xwQWc=' 
WHERE 
  key_id = '36f2cc33612100dc2607bc791ba82ac09234f68569940467c28cf96a59aa7476' 
  AND (
    token = 'fiH4lhw5MweUpUVImxJl3yyaFvSnmGyCPc80l9xwQWc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031