UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'biYaz8oNFJZ4ZvKBQPqWCaGL+/SeSgfrfEE7roezSE4=' 
WHERE 
  key_id = '66b72dcbcef192c17008713e5b2ea15ac36f7cb3f104264d6df042f097cdeb34' 
  AND (
    token = 'biYaz8oNFJZ4ZvKBQPqWCaGL+/SeSgfrfEE7roezSE4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038