UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'O/mCNy4j7dTxz+X5BDy5/RP7Bwfq/O4+eoRzNkHuk3c=' 
WHERE 
  key_id = '540a234dee04aec4b08d92639a1ed058d72e7538e1a436bbe22b2a7d6feb662d' 
  AND (
    token = 'O/mCNy4j7dTxz+X5BDy5/RP7Bwfq/O4+eoRzNkHuk3c=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00056