UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'QZq+g7i/gKmJMknmugh95kQID7fyt57y4HsapZht5cg=' 
WHERE 
  key_id = '578f40adbe62decb890bb2026d620f2a469769494f3012906297d602957cb5d6' 
  AND (
    token = 'QZq+g7i/gKmJMknmugh95kQID7fyt57y4HsapZht5cg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032